
// Day19手写：

1.手写算法：https://leetcode-cn.com/problems/two-sum

/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function (nums, target) {
    let m = new Map();

    for (let i = 0; i < nums.length; i++) {
        let n = target - nums[i]
        if (!m.has(n)) {
            m.set(nums[i], i)
        } else {
            return [m.get(n), i]
        }
    }
};

// 2.手写题
function compose() {
    //请实现
}
const multiply20 = (price) => price * 20;
const divide100 = (price) => price / 100;
const normalizePrice = (price) => price.toFixed(2);
const discount = compose(normalizePrice, divide100, multiply20);
discount(200.0); //40.00